<?php echo $commander->getListCommandsPanel('sa-a-d', ''); ?>
<div class="menu_list">
	<table style="clear:both;" id="menulist" class="item_list" cellspacing="0" cellpadding="0" border="0">
        <thead class="fields">
            <tr>
                <th class="first center">&nbsp;&nbsp;Id&nbsp;&nbsp;</th>
                <th><?php echo ucfirst($txt->getWord('choose')); ?></th>
                <th>&nbsp;</th>
	            <th>&nbsp;&nbsp;#&nbsp;&nbsp;</th>
                <th><?php echo ucfirst($txt->getWord('name')); ?></th>
                <th><?php echo ucfirst($txt->getWord('imo_number')); ?></th>
                <th><?php echo ucfirst($txt->getWord('order')); ?></th>
                <th><?php echo ucfirst($txt->getWord('active')); ?></th>
                <th><?php echo ucfirst($txt->getWord('ship_schedule')); ?></th>
                <th class="last"><?php echo ucfirst($txt->getWord('delete')); ?></th>
            </tr>
        </thead>
        <tbody>
        	<tr class="items">
	            <td class="first center"><img 	title="<?php echo ucfirst($txt->getWord('new')); ?>"
                                                class="icon command" 
                                                src="<?php echo SYSICONS_URL; ?>add_16.gif" 
                                                onclick="if(document.getElementById('new_ship_name').value != '') { edit_form.submit(); }" /></td>
	            <td><input title="<?php echo ucfirst($txt->getWord('all')); ?>" class="select_all" type="checkbox" name="select_all" value="" /></td>
	            <td>&nbsp;</td>
                <td>&nbsp;</td>
	            <td><input class="small-m" name="new_ship_name" type="text" value="" maxlength="100" id="new_ship_name" /></td>
                <td><input class="small-m numeric" name="new_ship_identity_number" type="text" value="" maxlength="100" id="new_ship_identity_number" /></td>
	            <td colspan="4">&nbsp;</td>
	            <td class="last"></td>
	        </tr>
            <?php 
			print_r($fleet);
            if(count($fleet->getShipList()) > 0):
            foreach($fleet->getShipList() as $ship)
            {
            ?>
            <tr class="items">
            	<td class="first center"><?php echo $ship->getId(); ?><input type="hidden" name="ship_id[]" value="<?php echo $ship->getId(); ?>" /></td>
                <td><input class="select_list" type="checkbox" name="selected[]" value="<?php echo $ship->getId(); ?>" /></td>
                <td><a href="<?php echo SITE_URL; ?>?ship=<?php echo $ship->getIdentityNumber(); ?>" target="_blank"><img class="icon" src="<?php echo SYSICONS_URL; ?>product_16.gif" alt="ship" ref="ship" /></a></td>
                <td><?php echo ($ship->ShipOrder+1); ?>.</td>
                <td><input class="small-m" name="ship_name[]" type="text" value="<?php echo $ship->getName(); ?>" maxlength="100" /></td>
                <td><input class="small-m numeric int" name="ship_identity_number[]" type="text" value="<?php echo $ship->getIdentityNumber(); ?>" maxlength="10" /></td>
                <td class="center">
                    <?php echo $commander->getCommandButton('up', $ship->getId()); ?>
                    <?php echo $commander->getCommandButton('down', $ship->getId()); ?>
                </td>
                <td>
                	<?php echo $commander->getActivationFieldsObject($ship); ?>
                    <input type="hidden" name="ship_active[]" value="<?php echo $ship->getActive(); ?>" />
                </td>
                <td class="center">
                	<a href="<?php echo $commander->getFormAction(); ?>&amp;ship=<?php echo $ship->getId(); ?>"><img title="<?php echo ucfirst($txt->getWord('edit')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>time_16.gif" /></a>
                </td>
                <td class="last">
                <img title="<?php echo ucfirst($txt->getWord('delete').' '.$txt->getWord('ship')); ?>" class="icon command ship_delete" src="<?php echo SYSICONS_URL; ?>delete_16.gif" onclick="deleteDialog(<?php echo $ship->getId(); ?>);" />
                </td>
            </tr>
            <?php
            }
            ?>
            <?php endif; ?>
        </tbody>
    </table>
    <input type="hidden" name="ship_delete" id="ship_delete_id" value="0" />
</div>
<script type="text/javascript">
function deleteDialog(shipId)
{
	jQuery('#delete_dialog').dialog('open');
	jQuery('#delete_dialog').dialog({
		bgiframe: true,
		resizable: false,
		height:140,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('no')); ?>': function() 
			{
				jQuery(this).dialog('close');
			},
			'<?php echo ucfirst($txt->getWord('delete').' '.getWord('ship')); ?>': function() 
			{
				jQuery('#ship_delete_id').val(shipId);
				jQuery(this).dialog('close');
				jQuery('#edit_form').submit();
			}
		}
	});
}
</script>
<div id="delete_dialog" title="<?php echo ucfirst($txt->getWord('delete').' '.$txt->getWord('ship')); ?>?" style="display:none; text-align:left;">
	<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><?php echo ucfirst($txt->getWord('sure_you_want_to_delete')); ?></p>
</div>